from qcloud_cos import CosConfig
from qcloud_cos import CosS3Client


secret_id = 'AKIDmIXtPx9OOL3UfaMWXSEl0zoMdCZgZR5T'      # 替换为用户的 secretId
secret_key = 'GFCuSjmaKo1xbS9ZibEjUjjS7Wf7JUVG'      # 替换为用户的 secretKey
region = 'ap-chengdu'     # 替换为用户的 Region，区域：中国成都，相当于ap-chengdu

config = CosConfig(Region=region, SecretId=secret_id, SecretKey=secret_key)
# 2. 获取客户端对象
client = CosS3Client(config)

#  上传文件
response = client.upload_file(
   Bucket='zhao-1304881545',  # 要上传桶的名称
   LocalFilePath='index01.png',  # 本地文件路径
   Key='p1.png',  # 上传到桶之后的文件名
   PartSize=1,
   MAXThread=10,
   EnableMD5=False
)
print(response['ETag'])

